274. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2021-05-13 09:09:05 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

274.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/viewlayer.js2020-08-12 02:04:02 +0000
2/Applications/Ampps/www/Porto v4.0.0/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/viewlayer.js2021-02-14 02:06:18 +0000

274.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged2796
Changed13
Inserted00
Removed00

274.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

274.4 Active regular expressions

No regular expressions were active.

274.5 Comparison detail

1 /** 1 /**
2  * Mageplaza 2  * Mageplaza
3  * 3  *
4  * NOTICE OF LICENSE 4  * NOTICE OF LICENSE
5  * 5  *
6  * This source file is subject to the Mageplaza.com license that is 6  * This source file is subject to the Mageplaza.com license that is
7  * available through the world-wide-web at this URL: 7  * available through the world-wide-web at this URL:
8  * https://www.mageplaza.com/LICENSE.txt 8  * https://www.mageplaza.com/LICENSE.txt
9  * 9  *
10  * DISCLAIMER 10  * DISCLAIMER
11  * 11  *
12  * Do not edit or add to this file if you wish to upgrade this extension to newer 12  * Do not edit or add to this file if you wish to upgrade this extension to newer
13  * version in the future. 13  * version in the future.
14  * 14  *
15  * @category    Mageplaza 15  * @category    Mageplaza
16  * @package     Mageplaza_AjaxLayer 16  * @package     Mageplaza_AjaxLayer
17  * @copyright   Copyright (c) Mageplaza (http://www.mageplaza.com/) 17  * @copyright   Copyright (c) Mageplaza (http://www.mageplaza.com/)
18  * @license     https://www.mageplaza.com/LICENSE.txt 18  * @license     https://www.mageplaza.com/LICENSE.txt
19  */ 19  */
20  20 
21 define([ 21 define([
22     'jquery', 22     'jquery',
23     'Mageplaza_AjaxLayer/js/action/submit-filter', 23     'Mageplaza_AjaxLayer/js/action/submit-filter',
24     'Magento_Catalog/js/price-utils',
 24     'Magento_Catalog/js/price-utils', 
25     'jquery/ui',    
26     'accordion', 25     'accordion',
27     'productListToolbarForm' 26     'productListToolbarForm'
28 ], function ($, submitFilterAction, ultil) { 27 ], function ($, submitFilterAction, ultil) {
29     "use strict"; 28     "use strict";
30     var next_page = ""; 29     var next_page = "";
31     var loading = false; 30     var loading = false;
32     var infinite_loaded_count = 0; 31     var infinite_loaded_count = 0;
33     var active = false; 32     var active = false;
34  33 
35     $.widget('mageplaza.layer', $.mage.accordion, { 34     $.widget('mageplaza.layer', $.mage.accordion, {
36         options: { 35         options: {
37             openedState: 'active', 36             openedState: 'active',
38             collapsible: true, 37             collapsible: true,
39             multipleCollapsible: true, 38             multipleCollapsible: true,
40             animate: 200, 39             animate: 200,
41             productsListSelector: '#layer-product-list', 40             productsListSelector: '#layer-product-list',
42             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', 41             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]',
43             collapsibleElement: '[data-role=ln_collapsible]', 42             collapsibleElement: '[data-role=ln_collapsible]',
44             header: '[data-role=ln_title]', 43             header: '[data-role=ln_title]',
45             content: '[data-role=ln_content]', 44             content: '[data-role=ln_content]',
46             isCustomerLoggedIn: false, 45             isCustomerLoggedIn: false,
47             params: [], 46             params: [],
48             active: [] 47             active: []
49         }, 48         },
50  49 
51         inFinite: function() { 50         inFinite: function() {
52             var self = this; 51             var self = this;
53             next_page = ""; 52             next_page = "";
54             if($(self.options.productsListSelector +' .infinite-loader').length > 0){ 53             if($(self.options.productsListSelector +' .infinite-loader').length > 0){
55                 active = true; 54                 active = true;
56             } 55             }
57             $(".pages-items li > a.next").each(function(){ 56             $(".pages-items li > a.next").each(function(){
58                 next_page = $(this).attr("href"); 57                 next_page = $(this).attr("href");
59             }); 58             });
60             if(!next_page){ 59             if(!next_page){
61                 $('.infinite-loader').hide(); 60                 $('.infinite-loader').hide();
62             } 61             }
63             $(".infinite-loader .btn-load-more").click(function(){ 62             $(".infinite-loader .btn-load-more").click(function(){
64                 if(!loading && next_page){ 63                 if(!loading && next_page){
65                     loading = true; 64                     loading = true;
66                     self.ajaxInfinite(next_page); 65                     self.ajaxInfinite(next_page);
67                 } 66                 }
68             }); 67             });
69         }, 68         },
70  69 
71         ajaxInfinite: function (submitUrl) { 70         ajaxInfinite: function (submitUrl) {
72             var self = this; 71             var self = this;
73             infinite_loaded_count++; 72             infinite_loaded_count++;
74             $('.infinite-loader .btn-load-more').hide(); 73             $('.infinite-loader .btn-load-more').hide();
75             $('.infinite-loader .loading').show(); 74             $('.infinite-loader .loading').show();
76             $.ajax({ 75             $.ajax({
77                 url: submitUrl, 76                 url: submitUrl,
78                 type: 'get', 77                 type: 'get',
79                 beforeSend: function () { 78                 beforeSend: function () {
80                     $('.infinite-loader .btn-load-more').hide(); 79                     $('.infinite-loader .btn-load-more').hide();
81                     $('.infinite-loader .loading').show(); 80                     $('.infinite-loader .loading').show();
82                 }, 81                 },
83                 success: function (res) { 82                 success: function (res) {
84                     loading = false; 83                     loading = false;
85                     var $products = $(res.products); 84                     var $products = $(res.products);
86                     if (res.backUrl) { 85                     if (res.backUrl) {
87                         window.location = res.backUrl; 86                         window.location = res.backUrl;
88                         return; 87                         return;
89                     } 88                     }
90                     if($products){ 89                     if($products){
91                         $products.each(function(i,el){ 90                         $products.each(function(i,el){
92                             if($(el).hasClass('products-grid')){ 91                             if($(el).hasClass('products-grid')){
93                                 var items_grid = $(this).find('.product-items .item'); 92                                 var items_grid = $(this).find('.product-items .item');
94                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); 93                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid);
95                                 $(self.options.productsListSelector).trigger('contentUpdated'); 94                                 $(self.options.productsListSelector).trigger('contentUpdated');
96                             } 95                             }
97                             if($(el).hasClass('products-list')){ 96                             if($(el).hasClass('products-list')){
98                                 var items_list = $(this).find('.product-items .item'); 97                                 var items_list = $(this).find('.product-items .item');
99                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); 98                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list);
100                                 $(self.options.productsListSelector).trigger('contentUpdated'); 99                                 $(self.options.productsListSelector).trigger('contentUpdated');
101                             } 100                             }
102                             if($(el).hasClass('toolbar-products')){ 101                             if($(el).hasClass('toolbar-products')){
103                                 if($(this).find('.pages a.next').length > 0){ 102                                 if($(this).find('.pages a.next').length > 0){
104                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); 103                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href'));
105                                 }else{ 104                                 }else{
106                                     $(self.options.productsListSelector + ' .pages a.next').remove(); 105                                     $(self.options.productsListSelector + ' .pages a.next').remove();
107                                 } 106                                 }
108                             } 107                             }
109                         }); 108                         });
110                         if($("form[data-role=tocart-form]").length > 0) { 109                         if($("form[data-role=tocart-form]").length > 0) {
111                             $("form[data-role=tocart-form]").catalogAddToCart(); 110                             $("form[data-role=tocart-form]").catalogAddToCart();
112                         } 111                         }
113                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); 112                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n');
114                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); 113                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1');
115                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); 114                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n');
116                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); 115                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1');
117                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); 116                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n');
118                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); 117                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1');
119                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); 118                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n');
120                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); 119                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1');
121                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); 120                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n');
122                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); 121                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1');
123                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); 122                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n');
124                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); 123                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1');
125                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); 124                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n');
126                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); 125                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1');
127                         var hist = submitUrl; 126                         var hist = submitUrl;
128                         if(submitUrl.indexOf("p=") > -1){ 127                         if(submitUrl.indexOf("p=") > -1){
129                             var len = submitUrl.length-submitUrl.indexOf("p="); 128                             var len = submitUrl.length-submitUrl.indexOf("p=");
130                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); 129                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len);
131                             var page_param = ""; 130                             var page_param = "";
132                             if(str_temp.indexOf("&") == -1){ 131                             if(str_temp.indexOf("&") == -1){
133                                 page_param = str_temp; 132                                 page_param = str_temp;
134                             } else { 133                             } else {
135                                 page_param = str_temp.substr(0,str_temp.indexOf("&")); 134                                 page_param = str_temp.substr(0,str_temp.indexOf("&"));
136                             } 135                             }
137                             hist = submitUrl.replace(page_param, ""); 136                             hist = submitUrl.replace(page_param, "");
138                         } 137                         }
139                         if (typeof window.history.pushState === 'function') { 138                         if (typeof window.history.pushState === 'function') {
140                             window.history.pushState({url: hist}, '', hist); 139                             window.history.pushState({url: hist}, '', hist);
141                         } 140                         }
142                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 141                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
143                             requirejs(['jquery', 'weltpixel_quickview' ], 142                             requirejs(['jquery', 'weltpixel_quickview' ],
144                                 function($, quickview) { 143                                 function($, quickview) {
145                                     $('.weltpixel-quickview').off('click').on('click', function() { 144                                     $('.weltpixel-quickview').off('click').on('click', function() {
146                                         var prodUrl = $(this).attr('data-quickview-url'); 145                                         var prodUrl = $(this).attr('data-quickview-url');
147                                         if (prodUrl.length) { 146                                         if (prodUrl.length) {
148                                             quickview.displayContent(prodUrl); 147                                             quickview.displayContent(prodUrl);
149                                         } 148                                         }
150                                     }); 149                                     });
151                                 }); 150                                 });
152                         } 151                         }
153                         $(".products-grid .weltpixel-quickview").each(function(){ 152                         $(".products-grid .weltpixel-quickview").each(function(){
154                             $(this).appendTo($(this).parent().parent().children(".product-item-photo")); 153                             $(this).appendTo($(this).parent().parent().children(".product-item-photo"));
155                         }); 154                         });
156                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 155                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
157                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 156                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
158                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { 157                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() {
159                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 158                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
160                             }); 159                             });
161                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 160                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
162                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 161                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
163                             }); 162                             });
164                         } 163                         }
165                         next_page = ""; 164                         next_page = "";
166                         $(".pages-items li > a.next").each(function(){ 165                         $(".pages-items li > a.next").each(function(){
167                             next_page = $(this).attr("href"); 166                             next_page = $(this).attr("href");
168                         }); 167                         });
169                         $('.infinite-loader .loading').hide(); 168                         $('.infinite-loader .loading').hide();
170                         if(next_page){ 169                         if(next_page){
171                             $('.infinite-loader .btn-load-more').show(); 170                             $('.infinite-loader .btn-load-more').show();
172                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){ 171                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){
173                                 if(!loading && next_page){ 172                                 if(!loading && next_page){
174                                     loading = true; 173                                     loading = true;
175                                     self.ajaxInfinite(next_page); 174                                     self.ajaxInfinite(next_page);
176                                 } 175                                 }
177                             }); 176                             });
178                         } 177                         }
179                     } 178                     }
180  179 
181                 }, 180                 },
182                 error: function () { 181                 error: function () {
183                     window.location.reload(); 182                     window.location.reload();
184                 } 183                 }
185             }); 184             });
186         }, 185         },
187  186 
188         _create: function () { 187         _create: function () {
189             this.initActiveItems(); 188             this.initActiveItems();
190  189 
191             this._super(); 190             this._super();
192  191 
193             this.initProductListUrl(); 192             this.initProductListUrl();
194             this.initObserve(); 193             this.initObserve();
195             this.initWishlistCompare(); 194             this.initWishlistCompare();
196         }, 195         },
197  196 
198         initActiveItems: function () { 197         initActiveItems: function () {
199             var layerActives = this.options.active, 198             var layerActives = this.options.active,
200                 actives = []; 199                 actives = [];
201  200 
202             if (typeof window.layerActiveTabs !== 'undefined') { 201             if (typeof window.layerActiveTabs !== 'undefined') {
203                 layerActives = window.layerActiveTabs; 202                 layerActives = window.layerActiveTabs;
204             } 203             }
205             if (layerActives.length) { 204             if (layerActives.length) {
206                 this.element.find('.filter-options-item').each(function (index) { 205                 this.element.find('.filter-options-item').each(function (index) {
207                     if (~$.inArray($(this).attr('attribute'), layerActives)) { 206                     if (~$.inArray($(this).attr('attribute'), layerActives)) {
208                         actives.push(index); 207                         actives.push(index);
209                     } 208                     }
210                 }); 209                 });
211             } 210             }
212  211 
213             this.options.active = actives; 212             this.options.active = actives;
214  213 
215             return this; 214             return this;
216         }, 215         },
217  216 
218         initProductListUrl: function () { 217         initProductListUrl: function () {
219             var isProcessToolbar = false; 218             var isProcessToolbar = false;
220             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 219             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
221                 if (isProcessToolbar) { 220                 if (isProcessToolbar) {
222                     return; 221                     return;
223                 } 222                 }
224                 isProcessToolbar = true; 223                 isProcessToolbar = true;
225  224 
226                 var urlPaths = this.options.url.split('?'), 225                 var urlPaths = this.options.url.split('?'),
227                     baseUrl = urlPaths[0], 226                     baseUrl = urlPaths[0],
228                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 227                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
229                     paramData = {}, 228                     paramData = {},
230                     parameters; 229                     parameters;
231                 for (var i = 0; i < urlParams.length; i++) { 230                 for (var i = 0; i < urlParams.length; i++) {
232                     parameters = urlParams[i].split('='); 231                     parameters = urlParams[i].split('=');
233                     paramData[parameters[0]] = parameters[1] !== undefined 232                     paramData[parameters[0]] = parameters[1] !== undefined
234                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 233                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
235                         : ''; 234                         : '';
236                 } 235                 }
237                 paramData[paramName] = paramValue; 236                 paramData[paramName] = paramValue;
238                 if (paramValue === defaultValue) { 237                 if (paramValue === defaultValue) {
239                     delete paramData[paramName]; 238                     delete paramData[paramName];
240                 } 239                 }
241                 paramData = $.param(paramData); 240                 paramData = $.param(paramData);
242                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); 241                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : ''));
243             } 242             }
244         }, 243         },
245  244 
246         initObserve: function () { 245         initObserve: function () {
247             var self = this; 246             var self = this;
248             infinite_loaded_count = 0; 247             infinite_loaded_count = 0;
249  248 
250             // fix browser back, forward button 249             // fix browser back, forward button
251             if (typeof window.history.replaceState === "function") { 250             if (typeof window.history.replaceState === "function") {
252                 window.history.replaceState({url: document.URL}, document.title); 251                 window.history.replaceState({url: document.URL}, document.title);
253  252 
254                 setTimeout(function () { 253                 setTimeout(function () {
255                     window.onpopstate = function (e) { 254                     window.onpopstate = function (e) {
256                         if (e.state) { 255                         if (e.state) {
257                             submitFilterAction(e.state.url, 1); 256                             submitFilterAction(e.state.url, 1);
258                         } 257                         }
259                     }; 258                     };
260                 }, 0) 259                 }, 0)
261             } 260             }
262  261 
263             var pageElements = $('#layer-product-list').find('.pages a'); 262             var pageElements = $('#layer-product-list').find('.pages a');
264             pageElements.each(function () { 263             pageElements.each(function () {
265                 var el = $(this), 264                 var el = $(this),
266                     link = self.checkUrl(el.prop('href')); 265                     link = self.checkUrl(el.prop('href'));
267                 if (!link) { 266                 if (!link) {
268                     return; 267                     return;
269                 } 268                 }
270  269 
271                 el.bind('click', function (e) { 270                 el.bind('click', function (e) {
272                     submitFilterAction(link); 271                     submitFilterAction(link);
273                     e.stopPropagation(); 272                     e.stopPropagation();
274                     e.preventDefault(); 273                     e.preventDefault();
275                 }) 274                 })
276             }); 275             });
277  276 
278             var currentElements = this.element.find('.filter-current a, .filter-actions a'); 277             var currentElements = this.element.find('.filter-current a, .filter-actions a');
279             currentElements.each(function (index) { 278             currentElements.each(function (index) {
280                 var el = $(this), 279                 var el = $(this),
281                     link = self.checkUrl(el.prop('href')); 280                     link = self.checkUrl(el.prop('href'));
282                 if (!link) { 281                 if (!link) {
283                     return; 282                     return;
284                 } 283                 }
285  284 
286                 el.bind('click', function (e) { 285                 el.bind('click', function (e) {
287                     submitFilterAction(link); 286                     submitFilterAction(link);
288                     e.stopPropagation(); 287                     e.stopPropagation();
289                     e.preventDefault(); 288                     e.preventDefault();
290                 }); 289                 });
291             }); 290             });
292  291 
293             var optionElements = this.element.find('.filter-options a'); 292             var optionElements = this.element.find('.filter-options a');
294             optionElements.each(function (index) { 293             optionElements.each(function (index) {
295                 var el = $(this), 294                 var el = $(this),
296                     link = self.checkUrl(el.prop('href')); 295                     link = self.checkUrl(el.prop('href'));
297                 if (!link) { 296                 if (!link) {
298                     return; 297                     return;
299                 } 298                 }
300  299 
301                 el.bind('click', function (e) { 300                 el.bind('click', function (e) {
302                     if (el.hasClass('swatch-option-link-layered')) { 301                     if (el.hasClass('swatch-option-link-layered')) {
303                         self.selectSwatchOption(el); 302                         self.selectSwatchOption(el);
304                     } 303                     }
305  304 
306                     self.ajaxSubmit(link); 305                     self.ajaxSubmit(link);
307                     e.stopPropagation(); 306                     e.stopPropagation();
308                     e.preventDefault(); 307                     e.preventDefault();
309                 }); 308                 });
310             }); 309             });
311  310 
312             var swatchElements = this.element.find('.swatch-attribute'); 311             var swatchElements = this.element.find('.swatch-attribute');
313             swatchElements.each(function (index) { 312             swatchElements.each(function (index) {
314                 var el = $(this); 313                 var el = $(this);
315                 var attCode = el.attr('attribute-code'); 314                 var attCode = el.attr('attribute-code');
316                 if (attCode) { 315                 if (attCode) {
317                     if (self.options.params.hasOwnProperty(attCode)) { 316                     if (self.options.params.hasOwnProperty(attCode)) {
318                         var attValues = self.options.params[attCode].split(","); 317                         var attValues = self.options.params[attCode].split(",");
319                         var swatchOptions = el.find('.swatch-option'); 318                         var swatchOptions = el.find('.swatch-option');
320                         swatchOptions.each(function (option) { 319                         swatchOptions.each(function (option) {
321                             var elOption = $(this); 320                             var elOption = $(this);
322                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { 321                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) {
323                                 elOption.addClass('selected'); 322                                 elOption.addClass('selected');
324                             } 323                             }
325                         }); 324                         });
326                     } 325                     }
327                 } 326                 }
328             }); 327             });
329  328 
330             if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 329             if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
331                 requirejs(['jquery', 'weltpixel_quickview' ], 330                 requirejs(['jquery', 'weltpixel_quickview' ],
332                     function($, quickview) { 331                     function($, quickview) {
333                         $('.weltpixel-quickview').off('click').on('click', function() { 332                         $('.weltpixel-quickview').off('click').on('click', function() {
334                             var prodUrl = $(this).attr('data-quickview-url'); 333                             var prodUrl = $(this).attr('data-quickview-url');
335                             if (prodUrl.length) { 334                             if (prodUrl.length) {
336                                 quickview.displayContent(prodUrl); 335                                 quickview.displayContent(prodUrl);
337                             } 336                             }
338                         }); 337                         });
339                     }); 338                     });
340             } 339             }
341  340 
342             $(".products-grid .weltpixel-quickview").each(function(){ 341             $(".products-grid .weltpixel-quickview").each(function(){
343                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); 342                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo"));
344             }); 343             });
345             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 344             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
346             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 345             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
347                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 346                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
348                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 347                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
349                 }); 348                 });
350             } 349             }
351             self.inFinite(); 350             self.inFinite();
352         }, 351         },
353  352 
354         selectSwatchOption: function (el) { 353         selectSwatchOption: function (el) {
355             var childEl = el.find('.swatch-option'); 354             var childEl = el.find('.swatch-option');
356             if (childEl.hasClass('selected')) { 355             if (childEl.hasClass('selected')) {
357                 childEl.removeClass('selected'); 356                 childEl.removeClass('selected');
358             } else { 357             } else {
359                 childEl.addClass('selected'); 358                 childEl.addClass('selected');
360             } 359             }
361         }, 360         },
362  361 
363         ajaxSubmit: function (submitUrl) { 362         ajaxSubmit: function (submitUrl) {
364             this.element.find(this.options.mobileShopbyElement).trigger('click'); 363             this.element.find(this.options.mobileShopbyElement).trigger('click');
365  364 
366             return submitFilterAction(submitUrl); 365             return submitFilterAction(submitUrl);
367         }, 366         },
368  367 
369         checkUrl: function (url) { 368         checkUrl: function (url) {
370             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 369             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
371  370 
372             return regex.test(url) ? url : null; 371             return regex.test(url) ? url : null;
373         }, 372         },
374  373 
375         //Handling 'add to wishlist' & 'add to compare' event 374         //Handling 'add to wishlist' & 'add to compare' event
376         initWishlistCompare: function () { 375         initWishlistCompare: function () {
377             var isCustomerLoggedIn = this.options.isCustomerLoggedIn, 376             var isCustomerLoggedIn = this.options.isCustomerLoggedIn,
378                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); 377                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : '');
379             $(elClass).each(function () { 378             $(elClass).each(function () {
380                 var el = $(this); 379                 var el = $(this);
381                 $(el).bind('click', function (e) { 380                 $(el).bind('click', function (e) {
382                     var dataPost = $(el).data('post'), 381                     var dataPost = $(el).data('post'),
383                         formKey = $('input[name="form_key"]').val(); 382                         formKey = $('input[name="form_key"]').val();
384                     if (formKey) { 383                     if (formKey) {
385                         dataPost.data.form_key = formKey; 384                         dataPost.data.form_key = formKey;
386                     } 385                     }
387  386 
388                     var paramData = $.param(dataPost.data), 387                     var paramData = $.param(dataPost.data),
389                         url = dataPost.action + (paramData.length ? '?' + paramData : ''); 388                         url = dataPost.action + (paramData.length ? '?' + paramData : '');
390  389 
391                     submitFilterAction(url, true); 390                     submitFilterAction(url, true);
392                     e.stopPropagation(); 391                     e.stopPropagation();
393                     e.preventDefault(); 392                     e.preventDefault();
394                 }); 393                 });
395             }) 394             })
396         } 395         }
397     }); 396     });
398  397 
399     return $.mageplaza.layer; 398     return $.mageplaza.layer;
400 }); 399 });